import request from '@/utils/request'

//负责人配置列表
export function getList(params) {
    return request({
      url: `/responsible/person/list`,
      method: 'get',
      params
    })
}
//负责人配置树状列表
export function getTreeList() {
  return request({
    url: `/responsible/person/tree`,
    method: 'get',
  })
}
// 负责人权限列表
export function authorityList(params) {
    return request({
      url: `/responsible/person/authority/list`,
      method: 'get',
      params
    })
}

//负责人下拉列表
export function userList(params) {
    return request({
      url: `/responsible/person/sys/user/list`,
      method: 'get',
      params
    })
}


//查询上级负责人下拉列表
export function personUpList(params) {
  return request({
    url: `/responsible/person/superiors/responsible/select`,
    method: 'get',
    params
  })
}

//添加负责人
export function addPerson(data) {
  return request({
    url: '/responsible/person',
    method: 'post',
    data
  })
}

//编辑负责人
export function editPerson(data) {
    return request({
      url: `/responsible/person`,
      method: 'put',
      data
    })
}

//负责人信息详情
export function personInfo(id) {
  return request({
    url: `responsible/person/detail/${id}`,
    method: 'get',
  })
}

//获取下属人数
export function personUnderling(id) {
  return request({
    url: `responsible/person/underling/${id}`,
    method: 'get',
  })
}

//获取用户信息
export function userInfo(id) {
    return request({
      url: `responsible/person/getUserInfo/${id}`,
      method: 'get',
    })
}

//前往管理端
export function redirect(id) {
    return request({
      url: `/anchor/sys/user/redirect/${id}`,
      method: 'get',
    })
}

//关联钉钉
export function addDingTalk(data) {
  return request({
    url: '/responsible/person/ding/talk',
    method: 'put',
    data
  })
}

// 获取删除详情
export function responsibleRemoveDetail(id) {
  return request({
    url: `/responsible/person/remove/detail/${id}`,
    method: 'get',
  })
}
//删除负责人
export function deleteResponsible(data) {
  return request({
    url: '/responsible/person',
    method: 'delete',
    data
  })
}

